Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'up' and 'down' values for offset option #297

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AndClarke
Copy link

This very simple update makes offset more powerful. Use case:

  1. You want scroll up to always pin the navigation.
  2. You want scroll down to leave the navigation alone until the navigation is above the fold.

offset = 0 accomplishes (1) but not (2).
offset = NAV_HEIGHT accomplishes (2) but not (1).

With this update you can set offset = {'up': 0, 'down': NAV_HEIGHT} to accomplish both.

@@ -345,7 +345,7 @@ Headroom.prototype = {
return;
}

if (currentScrollY <= this.offset ) {
if (currentScrollY <= this.offset['up'] ) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndClarke shouldn't this be this.offset['down']?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants